package sort;

public class SelectSort {

    private  int[] array;

    public SelectSort(int[] array) {
        this.array = array;
    }

    public  void  sort(){
        int min = 0;
        for (int i = 0; i < this.array.length; i++) {
            min = i;
            for (int j = i+1; j < this.array.length; j++) {
                if (array[j]<array[min]){
                    min = j;
                }
            }
            if (min != i){
                int temp = array[i];
                array[i] = array[min];
                array[min] = temp;
            }
        }
    }
}
